﻿namespace LoD.WPClientLibrary.Animations {
    public class FrameBounce : Animation {
        public FrameBounce(int start, int end, int direction) {
            Animating = true;
            this.Start = start;
            this.End = end;
            this.Direction = direction;
        }

        public int Direction { get; set; }
        public int End { get; set; }
        public int Start { get; set; }

        public override int ModifyFrame(int current) {
            current += this.Direction;
            if (current > this.End) {
                this.Direction *= -1;
                current = this.End;
            } else if (current < this.Start) {
                this.Direction *= -1;
                current = this.Start;
            }

            return current;
        }
    }
}